
<template>
<h2>理财显示信息</h2>
    投资名称:
    <input type="text" v-model="name">
    <input type="button" value="查询" @click="SelectData">
    <table border="1" class="table table-border">
        <thead>
            <tr>
                <td>理财编号</td>
                <td>项目名称</td>
                <td>年收益</td>
                <td>月收益</td>
                <td>最低金额</td>
                <td>理财人数</td>
                <td>风险等级</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <tr v-for="item in data" :key="item.I_Id">
                <td>{{ item.I_Id }}</td>
                <td>{{ item.I_Name }}</td>
                <td>{{ item.I_YearPrice }}</td>
                <td>{{ item.I_MonPrice }}</td>
                <td>{{ item.I_Price }}</td>
                <td>{{ item.I_Number }}</td>
                <td>{{ item.I_State }}</td>
                <td>
                    <input type="button" value="修改" @click="Onclick(item.I_Id)">
                </td>
            </tr>
        </tbody>
    </table>
</template>

<script setup lang="ts">

import { ref,onMounted } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
const router =useRouter();
const data=ref([{
    I_Id:0,
    I_Name:"",
    I_YearPrice:"",
    I_MonPrice:"",
    I_Price:"",
    I_Number:"",
    I_State:""
}])
const name=ref("");

onMounted(()=>{
    SelectData();
})
const SelectData=()=>{
        axios({
            method:"get",
            url:"http://localhost:54675/api/Goods/SelectData",
            params:{
                name:name.value
            }
        })
        .then(function(res){
            data.value=res.data
        })
}
const Onclick=(id:number)=>{
    router.push({
        name:"EnitWorld",
        params:{
            id:id
        }
    })
}

</script>